//
//  ViewFoot.m
//  NewPro
//
//  Created by 何荧红 on 2018/10/7.
//  Copyright © 2018 何荧红. All rights reserved.
//

#import "ViewFoot.h"
#import "PostlistModel.h"


@interface ViewFoot ()
@property (nonatomic, strong) UILabel *money;
@property (nonatomic, strong) UILabel *allSnNumber;
@property (nonatomic, strong) UILabel *rageNumber;
@property (nonatomic, strong) UILabel *regSnnumber;

@property (nonatomic, strong) UIView *POSFootfirst;
@property (nonatomic, strong) UIView *POSFootSec;


@property (nonatomic, strong) UIView *POSTopView;
@property (nonatomic, strong) UIButton *POSCancel;
@property (nonatomic, strong) UIButton *POSSure;

@end

@implementation ViewFoot
- (void)setFristPosnumber:(NSString *)FristPosnumber{
    _FristPosnumber = FristPosnumber;
    if (_FristPosnumber.length > 0) {
        self.allSnNumber.text = [NSString stringWithFormat:@"终端数量：%@台",_FristPosnumber];
    }
}
- (void)setSecondPosnumber:(NSString *)SecondPosnumber{
    _SecondPosnumber = SecondPosnumber;
    if (_SecondPosnumber.length > 0) {
        self.rageNumber.text = [NSString stringWithFormat:@"已开通：%@台",_SecondPosnumber];
    }else{
        self.rageNumber.text = _SecondPosnumber;
    }
}
-(void)setThridPosnumber:(NSString *)ThridPosnumber{
    _ThridPosnumber = ThridPosnumber;
    if (_ThridPosnumber.length > 0) {
        if(self.MyPOSListType == 10){
            _regSnnumber.text = [NSString stringWithFormat:@"已回拨：%@台",_ThridPosnumber];
        }else if(self.MyPOSListType == 11){
            _regSnnumber.text = [NSString stringWithFormat:@"已接收：%@台",_ThridPosnumber];
        }else{
            _regSnnumber.text = [NSString stringWithFormat:@"已激活：%@台",_ThridPosnumber];
        }
    }else{
        _regSnnumber.text = _ThridPosnumber;
    }
}
- (void)setAllnumber:(NSInteger)allnumber{
    _allnumber = allnumber;
    _allSnNumber.text = [NSString stringWithFormat:@"终端数量：%ld台",_allnumber];
}
- (void)setCliknumber:(NSInteger)cliknumber{
    _cliknumber = cliknumber;
    if (self.MyPOSListType == 5) {
        _regSnnumber.text = [NSString stringWithFormat:@"已返：%ld台",_cliknumber];
    }else if (self.MyPOSListType == 11){
        _regSnnumber.text = [NSString stringWithFormat:@"已接受：%ld台",_cliknumber];
    }else{
        _regSnnumber.text = [NSString stringWithFormat:@"已选择：%ld台",_cliknumber];
    }
}
- (void)setMinnumber:(NSInteger)minnumber{
    _minnumber = minnumber;
    _numberfield.placeholder = [NSString stringWithFormat:@"当前可设置范围0-%ld元/台",_minnumber];
}
- (void)setPrice:(NSString *)price{
    _price = price;
    if (_price) {
        _money.text = [NSString stringWithFormat:@"¥%@",_price];
    }
}
- (instancetype)initWithFootView{
    self = [super init];
    if (self) {
        self.frame = CGRectMake(0, SCREEN_HEIGHT - 54 - iPhoneX_Bottom, SCREEN_WIDTH, 54);
        self.backgroundColor = [UIColor whiteColor];
        [self CleanButtonView];
    }
    return self;
}
- (instancetype)initWithAdressFoot{
    self = [super init];
    if (self) {
        self.backgroundColor = [UIColor colorWithHexString:@"fafafa"];
        self.frame = CGRectMake(0, SCREEN_HEIGHT - 49 - iPhoneX_Bottom, SCREEN_WIDTH, 49);
        [self CleanAdressFoot];
    }
    return self;
}
- (instancetype)initWithDetele{
    self = [super init];
    if (self) {
        self.frame = CGRectMake(0, 0, SCREEN_WIDTH, 27);
        self.backgroundColor = [UIColor colorWithHexString:@"F1F1F1"];
        [self CleanDeteleView];
    }
    return self;
}
- (instancetype)initWithPOSFoot{
    self = [super init];
    if (self) {
        self.backgroundColor = [UIColor colorWithHexString:@"f4f4f4"];
        [self CleanPOSFootView];
    }
    return self;
}
- (instancetype)initWithPOSRecordFoot{
    self = [super init];
    if (self) {
        self.backgroundColor = [UIColor colorWithHexString:@"f4f4f4"];
        self.frame = CGRectMake(0, SCREEN_HEIGHT - 75 - iPhoneX_Bottom - iPhoneX_Top - 44, SCREEN_WIDTH, 75);
        [self CleanPOSRFootView];
    }
    return self;
}
- (instancetype)initWithPOSCanTransfer{
    self = [super init];
    if (self) {
        self.backgroundColor = [UIColor colorWithHexString:@"ffffff"];
//        self.frame = CGRectMake(0, SCREEN_HEIGHT - 49 - iPhoneX_Bottom, SCREEN_WIDTH, 49);
        [self CreatePOSCanTransfer];
    }
    return self;
}
- (void)CreatePOSCanTransfer{
    self.allSnNumber = [[UILabel alloc]init];
    self.allSnNumber.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:12];
    self.allSnNumber.textColor = [UIColor colorWithHexString:@"333333"];
    self.allSnNumber.text = @"终端数量：0台";
    [self addSubview:self.allSnNumber];
    [self.allSnNumber mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.mas_centerY);
        make.left.equalTo(self.mas_left).offset(14);
    }];
    self.regSnnumber = [[UILabel alloc]init];
    self.regSnnumber.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:12];
    self.regSnnumber.textColor = [UIColor colorWithHexString:@"333333"];
    self.regSnnumber.text = @"已选择：0台";
    [self addSubview:self.regSnnumber];
    [self.regSnnumber mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.mas_centerY);
        make.left.equalTo(self.allSnNumber.mas_right).offset(25);
    }];
    self.tonext = [[UIButton alloc]init];
    self.tonext.eventTimeInterval = 1;
    self.tonext.backgroundColor = [UIColor colorWithHexString:@"0CA6F0"];
    [self.tonext setTitle:@"确认回拨" forState:UIControlStateNormal];
    [self.tonext setTitleColor:[UIColor colorWithHexString:@"ffffff"] forState:UIControlStateNormal];
    [_tonext addTarget:self action:@selector(BusinessToSure:) forControlEvents:UIControlEventTouchUpInside];
    [self addSubview:_tonext];
    [_tonext mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self.mas_right);
        make.centerY.equalTo(self.mas_centerY);
        make.height.mas_equalTo(44);
        make.width.mas_equalTo(110);
    }];
}
- (instancetype)initWithMyProfitFoot{
    self = [super init];
    if (self) {
        self.backgroundColor = [UIColor colorWithHexString:@"FEE5C7"];
        self.frame = CGRectMake(0, 8, SCREEN_WIDTH, 57);
        [self CleanMyProfitFoot];
    }
    return self;
}
- (instancetype)initWithBusinessChoose{
    self = [super init];
    if (self) {
        self.backgroundColor = [UIColor whiteColor];
        self.frame = CGRectMake(0, SCREEN_HEIGHT - 104 - iPhoneX_Bottom - iPhoneX_Top - 44, SCREEN_WIDTH, 104);
        [self CleanWithBusinessChoose];
    }
    return self;
}
//0、未激活 1、审核中或者审核失败 2、已开通或者已激活 3、已达标 //对照button tag 则为 0 1 2 3 4 5 6
- (void)setMyPOSListType:(NSInteger)MyPOSListType{
    _MyPOSListType = MyPOSListType;
    self.POSFootfirst.hidden = YES;
    self.POSFootSec.hidden = YES;
    self.regSnnumber.hidden = NO;
    if (_MyPOSListType == 0) {
        self.frame = CGRectMake(0, SCREEN_HEIGHT - 104 - iPhoneX_Bottom - iPhoneX_Top - 44, SCREEN_WIDTH, 104);
        self.POSFootfirst.hidden = NO;
        self.POSFootSec.hidden = NO;
        self.allSnNumber.text = @"终端数量：0台";
        self.regSnnumber.text = @"已选择：0台";
    }
    if (_MyPOSListType == 1 || _MyPOSListType == 2 || _MyPOSListType == 3 || _MyPOSListType == 4) {
        self.regSnnumber.hidden = YES;
        self.frame = CGRectMake(0, SCREEN_HEIGHT - 30 - iPhoneX_Bottom - iPhoneX_Top - 44, SCREEN_WIDTH, 30);
        self.allSnNumber.text = @"终端数量：0台";
    }
    if (_MyPOSListType == 5) {
        self.frame = CGRectMake(0, SCREEN_HEIGHT - 30 - iPhoneX_Bottom - iPhoneX_Top - 44, SCREEN_WIDTH, 30);
        self.allSnNumber.text = @"终端数量：0台";
        self.regSnnumber.text = @"已返：0台";
    }
}
- (void)CleanWithBusinessChoose{
    self.POSFootfirst = [[UIView alloc]initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 44)];
    self.POSFootfirst.backgroundColor = [UIColor whiteColor];
    [self addSubview:self.POSFootfirst];
    UILabel *subset = [[UILabel alloc]init];
    subset.textColor = [UIColor colorWithHexString:@"333333"];
    subset.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:14];
    subset.text = @"设置返现金额";
    [self.POSFootfirst addSubview:subset];
    [subset mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.POSFootfirst.mas_left).offset(14);
        make.centerY.equalTo(self.POSFootfirst.mas_centerY);
    }];
    
    self.tonextlab = [[UILabel alloc]init];
    self.tonext.eventTimeInterval = 1;
    _tonextlab.layer.masksToBounds = YES;
    _tonextlab.layer.cornerRadius = 3;
    _tonextlab.backgroundColor = [UIColor colorWithHexString:@"0CA6F0"];
    _tonextlab.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:15];
    _tonextlab.textColor = [UIColor whiteColor];
    _tonextlab.textAlignment = NSTextAlignmentCenter;
    _tonextlab.text = @"划拨至";
    [self.POSFootfirst addSubview:_tonextlab];
    [_tonextlab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self.POSFootfirst.mas_right).offset(-14);
        make.centerY.equalTo(self.POSFootfirst.mas_centerY);
        make.height.mas_equalTo(25);
        make.width.mas_equalTo(60);
    }];
    
    self.tonext = [[UIButton alloc]init];
    [_tonext addTarget:self action:@selector(BusinessToSure:) forControlEvents:UIControlEventTouchUpInside];
    [self.POSFootfirst addSubview:_tonext];
    [_tonext mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self.POSFootfirst.mas_right);
        make.centerY.equalTo(self.POSFootfirst.mas_centerY);
        make.height.mas_equalTo(44);
        make.width.mas_equalTo(80);
    }];
    
    self.numberfield = [[UITextField alloc]init];
    [self.numberfield addTarget:self action:@selector(NumberClik) forControlEvents:UIControlEventEditingChanged];
    self.numberfield.keyboardType = UIKeyboardTypeNumberPad;
    _numberfield.textColor = [UIColor colorWithHexString:@"333333"];
    _numberfield.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:14];
    _numberfield.textAlignment = NSTextAlignmentLeft;
    [self.POSFootfirst addSubview:_numberfield];
    [_numberfield mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.POSFootfirst.mas_centerY);
        make.left.equalTo(subset.mas_right).offset(15);
        make.right.equalTo(self.tonext.mas_left);
        make.height.mas_equalTo(44);
    }];
    
    self.POSFootSec = [[UIView alloc]initWithFrame:CGRectMake(0, 44, SCREEN_WIDTH, 30)];
    self.POSFootSec.backgroundColor = [UIColor colorWithHexString:@"FFE7D3"];
    [self addSubview:self.POSFootSec];
    UILabel *subjin = [[UILabel alloc]init];
    subjin.textColor = [UIColor colorWithHexString:@"666666"];
    subjin.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:12];
    subjin.text = @"提示：返现金额的设置范围不得高于本级返现金额";
    [self.POSFootSec addSubview:subjin];
    [subjin mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.POSFootSec.mas_centerY);
        make.left.equalTo(self.POSFootSec.mas_left).offset(14);
    }];
    UIView *thriView = [[UIView alloc]init];
    thriView.backgroundColor = [UIColor whiteColor];
    [self addSubview:thriView];
    [thriView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.mas_left);
        make.bottom.equalTo(self.mas_bottom);
        make.width.mas_equalTo(SCREEN_WIDTH);
        make.height.mas_equalTo(30);
    }];
    self.allSnNumber = [[UILabel alloc]init];
    self.allSnNumber.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:12];
    self.allSnNumber.textColor = [UIColor colorWithHexString:@"333333"];
    self.allSnNumber.text = @"终端数量：0台";
    [thriView addSubview:self.allSnNumber];
    [self.allSnNumber mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(thriView.mas_centerY);
        make.left.equalTo(thriView.mas_left).offset(14);
    }];
    self.regSnnumber = [[UILabel alloc]init];
    self.regSnnumber.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:12];
    self.regSnnumber.textColor = [UIColor colorWithHexString:@"333333"];
    self.regSnnumber.text = @"已选择：0台";
    [thriView addSubview:self.regSnnumber];
    [self.regSnnumber mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(thriView.mas_centerY);
        make.right.equalTo(thriView.mas_right).offset(-14);
    }];
}
- (void)NumberClik{
    if (self.editBlock) self.editBlock();
}
- (void)BusinessToSure:(UIButton *)button{
    if (!button.selected) {
        if (self.moneytosureBlock) self.moneytosureBlock();
    }
    button.selected = !button.selected;
}
- (void)CleanMyProfitFoot{
    UILabel *msgtitle = [[UILabel alloc]init];
    msgtitle.font = [UIFont fontWithName:@"PingFang-SC-Regular" size:10];
    msgtitle.textColor = [UIColor colorWithHexString:@"F86912"];
    msgtitle.text = @"温馨提示：";
    [self addSubview:msgtitle];
    [msgtitle mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.mas_left).offset(14);
        make.top.equalTo(self.mas_top).offset(15);
        make.height.mas_equalTo(10);
    }];
    UILabel *msgtitle1 = [[UILabel alloc]init];
    msgtitle1.font = [UIFont fontWithName:@"PingFang-SC-Regular" size:10];
    msgtitle1.textColor = [UIColor colorWithHexString:@"F86912"];
    msgtitle1.text = @"本月预期收益正在更新，请于14:00后再次查询；";
    [self addSubview:msgtitle1];
    [msgtitle1 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(msgtitle.mas_centerY);
        make.left.equalTo(msgtitle.mas_right);
        make.height.mas_equalTo(10);
    }];
    UILabel *submsg = [[UILabel alloc]init];
    submsg.font = [UIFont fontWithName:@"PingFang-SC-Regular" size:10];
    submsg.textColor = [UIColor colorWithHexString:@"F86912"];
    submsg.text = @"本月收益数据仅供参考，请以实际发放收益为准。";
    [self addSubview:submsg];
    [submsg mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(msgtitle.mas_right);
        make.bottom.equalTo(self.mas_bottom).offset(-15);
        make.height.mas_equalTo(10);
    }];
}
- (void)setHiddenheight:(BOOL)hiddenheight{
    _hiddenheight = hiddenheight;
    if (_hiddenheight) {
        self.frame = CGRectMake(0, SCREEN_HEIGHT - 30 - iPhoneX_Bottom, SCREEN_WIDTH, 30);
        self.POSTopView.hidden = YES;
        self.POSCancel.hidden = YES;
        self.POSSure.hidden = YES;
    }else{
        self.frame = CGRectMake(0, SCREEN_HEIGHT - 75 - iPhoneX_Bottom, SCREEN_WIDTH, 75);
        self.POSTopView.hidden = NO;
        self.POSCancel.hidden = NO;
        self.POSSure.hidden = NO;
    }
}
- (void)setRhidden:(BOOL)Rhidden{
    _Rhidden = Rhidden;
    if (_Rhidden) {
        self.frame = CGRectMake(0, SCREEN_HEIGHT - 30 - iPhoneX_Bottom - iPhoneX_Top - 44, SCREEN_WIDTH, 30);
        self.POSTopView.hidden = YES;
        self.POSCancel.hidden = YES;
        self.POSSure.hidden = YES;
    }else{
        self.frame = CGRectMake(0, SCREEN_HEIGHT - 75 - iPhoneX_Bottom - iPhoneX_Top - 44, SCREEN_WIDTH, 75);
        self.POSTopView.hidden = NO;
        self.POSCancel.hidden = NO;
        self.POSSure.hidden = NO;
    }
}
- (void)CleanPOSRFootView{
    self.POSTopView = [[UIView alloc]init];
    [self addSubview:self.POSTopView];
    [self.POSTopView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.mas_left);
        make.right.equalTo(self.mas_right);
        make.top.equalTo(self.mas_top);
        make.height.mas_equalTo(44);
    }];
    self.POSCancel = [[UIButton alloc]init];
    [self.POSCancel addTarget:self action:@selector(POSCancelClik:) forControlEvents:UIControlEventTouchUpInside];
    self.POSCancel.backgroundColor = [UIColor whiteColor];
    self.POSCancel.titleLabel.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:14];
    [self.POSCancel setTitle:@"拒绝接收" forState:UIControlStateNormal];
    [self.POSCancel setTitleColor:[UIColor colorWithHexString:@"AC9376"] forState:UIControlStateNormal];
    [self.POSTopView addSubview:self.POSCancel];
    [self.POSCancel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.POSTopView);
        make.centerY.equalTo(self.POSTopView.mas_centerY);
        make.height.mas_equalTo(44);
        make.width.mas_equalTo(SCREEN_WIDTH/2);
    }];
    
    self.POSSure = [[UIButton alloc]init];
    [self.POSSure addTarget:self action:@selector(POSSureClik:) forControlEvents:UIControlEventTouchUpInside];
    self.POSSure.backgroundColor = [UIColor colorWithHexString:@"0CA6F0"];
    self.POSSure.titleLabel.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:14];
    [self.POSSure setTitle:@"确认接收" forState:UIControlStateNormal];
    [self.POSSure setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [self.POSTopView addSubview:self.POSSure];
    [self.POSSure mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.POSTopView).offset(SCREEN_WIDTH/2);
        make.centerY.equalTo(self.POSTopView.mas_centerY);
        make.height.mas_equalTo(44);
        make.width.mas_equalTo(SCREEN_WIDTH/2);
    }];
    
    UIView *bottom = [[UIView alloc]init];
    bottom.backgroundColor = [UIColor whiteColor];
    [self addSubview:bottom];
    [bottom mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.mas_left);
        make.right.equalTo(self.mas_right);
        make.bottom.equalTo(self.mas_bottom);
        make.height.mas_equalTo(30);
    }];
    
    self.allSnNumber = [[UILabel alloc]init];
    self.allSnNumber.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:12];
    self.allSnNumber.textColor = [UIColor colorWithHexString:@"333333"];
    self.allSnNumber.text = @"终端数量：0台";
    [bottom addSubview:self.allSnNumber];
    [self.allSnNumber mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(bottom.mas_centerY);
        make.left.equalTo(bottom.mas_left).offset(14);
    }];
    
    self.rageNumber = [[UILabel alloc]init];
    self.rageNumber.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:12];
    self.rageNumber.textColor = [UIColor colorWithHexString:@"333333"];
    self.rageNumber.text = @"已开通：0台";
    [bottom addSubview:self.rageNumber];
    [self.rageNumber mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(bottom.mas_centerY);
        make.centerX.equalTo(bottom.mas_centerX);
    }];
    self.regSnnumber = [[UILabel alloc]init];
    self.regSnnumber.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:12];
    self.regSnnumber.textColor = [UIColor colorWithHexString:@"333333"];
    self.regSnnumber.text = @"已激活：0台";
    [bottom addSubview:self.regSnnumber];
    [self.regSnnumber mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(bottom.mas_centerY);
        make.right.equalTo(bottom.mas_right).offset(-14);
    }];
    self.Rhidden = YES;
}
- (void)CleanPOSFootView{
    self.POSTopView = [[UIView alloc]init];
    [self addSubview:self.POSTopView];
    [self.POSTopView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.mas_left);
        make.right.equalTo(self.mas_right);
        make.top.equalTo(self.mas_top);
        make.height.mas_equalTo(44);
    }];
    self.POSCancel = [[UIButton alloc]init];
    [self.POSCancel addTarget:self action:@selector(POSCancelClik:) forControlEvents:UIControlEventTouchUpInside];
    self.POSCancel.backgroundColor = [UIColor whiteColor];
    self.POSCancel.titleLabel.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:14];
    [self.POSCancel setTitle:@"拒绝接收" forState:UIControlStateNormal];
    [self.POSCancel setTitleColor:[UIColor colorWithHexString:@"AC9376"] forState:UIControlStateNormal];
    [self.POSTopView addSubview:self.POSCancel];
    [self.POSCancel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.POSTopView);
        make.centerY.equalTo(self.POSTopView.mas_centerY);
        make.height.mas_equalTo(44);
        make.width.mas_equalTo(SCREEN_WIDTH/2);
    }];
    
    self.POSSure = [[UIButton alloc]init];
    [self.POSSure addTarget:self action:@selector(POSSureClik:) forControlEvents:UIControlEventTouchUpInside];
    self.POSSure.backgroundColor = [UIColor colorWithHexString:@"0CA6F0"];
    self.POSSure.titleLabel.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:14];
    [self.POSSure setTitle:@"确认接收" forState:UIControlStateNormal];
    [self.POSSure setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [self.POSTopView addSubview:self.POSSure];
    [self.POSSure mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.POSTopView).offset(SCREEN_WIDTH/2);
        make.centerY.equalTo(self.POSTopView.mas_centerY);
        make.height.mas_equalTo(44);
        make.width.mas_equalTo(SCREEN_WIDTH/2);
    }];

    UIView *bottom = [[UIView alloc]init];
    bottom.backgroundColor = [UIColor whiteColor];
    [self addSubview:bottom];
    [bottom mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.mas_left);
        make.right.equalTo(self.mas_right);
        make.bottom.equalTo(self.mas_bottom);
        make.height.mas_equalTo(30);
    }];

    self.allSnNumber = [[UILabel alloc]init];
    self.allSnNumber.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:12];
    self.allSnNumber.textColor = [UIColor colorWithHexString:@"333333"];
    self.allSnNumber.text = @"终端数量：0台";
    [bottom addSubview:self.allSnNumber];
    [self.allSnNumber mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(bottom.mas_centerY);
        make.left.equalTo(bottom.mas_left).offset(14);
    }];
    
    self.rageNumber = [[UILabel alloc]init];
    self.rageNumber.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:12];
    self.rageNumber.textColor = [UIColor colorWithHexString:@"333333"];
    self.rageNumber.text = @"已开通：0台";
    [bottom addSubview:self.rageNumber];
    [self.rageNumber mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(bottom.mas_centerY);
        make.centerX.equalTo(bottom.mas_centerX);
    }];
    self.regSnnumber = [[UILabel alloc]init];
    self.regSnnumber.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:12];
    self.regSnnumber.textColor = [UIColor colorWithHexString:@"333333"];
    self.regSnnumber.text = @"已激活：0台";
    [bottom addSubview:self.regSnnumber];
    [self.regSnnumber mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(bottom.mas_centerY);
        make.right.equalTo(bottom.mas_right).offset(-14);
    }];
    self.hiddenheight = YES;
}
- (void)POSCancelClik:(UIButton *)button{
    if (!button.selected) {
        if (self.deleteBlock) self.deleteBlock();
    }
    button.selected = !button.selected;
    if (self.POSSure) {
        self.POSSure.selected = YES;
    }
}
- (void)POSSureClik:(UIButton *)button{
    if (!button.selected) {
        if (self.moneytosureBlock) self.moneytosureBlock();
    }
    button.selected = !button.selected;
    if (self.POSCancel) {
        self.POSCancel.selected = YES;
    }
}
- (void)CleanButtonView{
    for (NSInteger i = 0; i < 2; i++) {
        UIButton *button = [[UIButton alloc]initWithFrame:CGRectMake(SCREEN_WIDTH/2 * i, 0, SCREEN_WIDTH/2, 54)];
        button.titleLabel.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:14];
        if (i == 0) {
            [button setBackgroundColor:[UIColor colorWithHexString:@"ffffff"]];
            [button setTitle:@"我的订单" forState:UIControlStateNormal];
            [button setTitleColor:[UIColor colorWithHexString:@"AC9376"] forState:UIControlStateNormal];
        }else if (i == 1){
            [button setBackgroundColor:[UIColor colorWithHexString:@"0CA6F0"]];
            [button setTitle:@"交纳押金" forState:UIControlStateNormal];
            [button setTitleColor:[UIColor colorWithHexString:@"ffffff"] forState:UIControlStateNormal];
        }
        button.tag = 2018 + i;
        [button addTarget:self action:@selector(buttonClik:) forControlEvents:UIControlEventTouchUpInside];
        [self addSubview:button];
    }
}
- (void)buttonClik:(UIButton *)button{
    if (button.tag - 2018 == 0) {
        if (self.myOrderBlock) self.myOrderBlock();
    }
    if (button.tag - 2018 == 1) {
        if (self.toSureBlock) self.toSureBlock();
    }
}
- (void)CleanDeteleView{
    self.buttonimg = [[UIImageView alloc]init];
    [self addSubview:self.buttonimg];
    [self.buttonimg mas_makeConstraints:^(MASConstraintMaker *make) {
        make.height.mas_equalTo(12);
        make.width.mas_equalTo(12);
        make.left.equalTo(self.mas_left).offset(14);
        make.centerY.equalTo(self.mas_centerY);
    }];
    UIButton *imgbutton = [[UIButton alloc]init];
    imgbutton.titleLabel.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:12];
    [imgbutton setTitleColor:[UIColor colorWithHexString:@"2BA0F5"] forState:UIControlStateNormal];
    [imgbutton setTitle:@"设为默认地址" forState:UIControlStateNormal];
    [imgbutton addTarget:self action:@selector(morenbutton) forControlEvents:UIControlEventTouchUpInside];
    [self addSubview:imgbutton];
    [imgbutton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.mas_centerY);
        make.left.equalTo(self.buttonimg.mas_right).offset(14);
        make.height.mas_equalTo(27);
    }];
    UIButton *detele = [[UIButton alloc]init];
    detele.titleLabel.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:12];
    [detele setTitleColor:[UIColor colorWithHexString:@"2BA0F5"] forState:UIControlStateNormal];
    [detele setTitle:@"删除" forState:UIControlStateNormal];
    [detele addTarget:self action:@selector(deletebutton) forControlEvents:UIControlEventTouchUpInside];
    [self addSubview:detele];
    [detele mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.mas_centerY);
        make.right.equalTo(self.mas_right).offset(-14);
        make.height.mas_equalTo(27);
    }];
    
    UIButton *edit = [[UIButton alloc]init];
    edit.titleLabel.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:12];
    [edit setTitleColor:[UIColor colorWithHexString:@"2BA0F5"] forState:UIControlStateNormal];
    [edit setTitle:@"编辑" forState:UIControlStateNormal];
    [edit addTarget:self action:@selector(editbutton) forControlEvents:UIControlEventTouchUpInside];
    [self addSubview:edit];
    [edit mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.mas_centerY);
        make.right.equalTo(detele.mas_left).offset(-14);
        make.height.mas_equalTo(27);
    }];
}
- (void)morenbutton{
    if (self.morenBlock) self.morenBlock();
}
- (void)deletebutton{
    if (self.deleteBlock) self.deleteBlock();
}
- (void)editbutton{
    if (self.editBlock) self.editBlock();
}

- (void)CleanAdressFoot{
    UIButton *sure = [[UIButton alloc]init];
    sure.titleLabel.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:16];
    sure.backgroundColor = [UIColor colorWithHexString:@"0CA6F0"];
    [sure setTitleColor:[UIColor colorWithHexString:@"FFFFFF"] forState:UIControlStateNormal];
    [sure setTitle:@"提交订单" forState:UIControlStateNormal];
    [sure addTarget:self action:@selector(adresstoSure) forControlEvents:UIControlEventTouchUpInside];
    [self addSubview:sure];
    [sure mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self.mas_right);
        make.top.equalTo(self.mas_top);
        make.height.mas_equalTo(49);
        make.width.mas_equalTo(110);
    }];
    self.money = [[UILabel alloc]init];
    _money.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:14];
    _money.textColor = [UIColor colorWithHexString:@"FF2F2F"];
    [self addSubview:_money];
    [_money mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(sure.mas_centerY);
        make.right.equalTo(sure.mas_left).offset(-15);
    }];
    UILabel *subtitle = [[UILabel alloc]init];
    subtitle.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:14];
    subtitle.textColor = [UIColor colorWithHexString:@"383838"];
    subtitle.text = @"合计金额：";
    [self addSubview:subtitle];
    [subtitle mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(sure.mas_centerY);
        make.right.equalTo(self.money.mas_left).offset(-2);
    }];
}
- (void)adresstoSure{
    if (self.OrdertoSureBlock) self.OrdertoSureBlock();
}


@end
